Open In Colab Kaggle

Finding missing town halls in Italy¶

Step 1: State Of The Art analysis¶

Configuration¶

In [ ]:
search_area_id = 3600365331 # Italia
#search_area_id = 3600042611 # Emilia-Romagna
#search_area_id = 3600040218 # Campania
# ID calculated with https://wiki.openstreetmap.org/wiki/Overpass_API/Overpass_QL#By_element_id
In [ ]:
province_json_file_path = f"./provinces_{search_area_id}.4326.geojson"
municipality_json_file_path = f"./municipalities_{search_area_id}.4326.geojson"
townhall_json_file_path = f"./townhalls_{search_area_id}.4326.geojson"
without_townhall_json_file_path = f"./without_townhall_{search_area_id}.4326.geojson"
dbsn_json_file_path = f"./municipi.geojson"
dbsn_conflict_file_path = f"./dbsn_conflicts_{search_area_id}.4326.geojson"
dbsn_missing_file_path = f"./dbsn_missing_{search_area_id}.4326.geojson"
untagged_json_file_path = f"./untagged_{search_area_id}.4326.geojson"
untagged_missing_json_file_path = f"./untagged_missing_{search_area_id}.4326.geojson"

Setup¶

In [ ]:
%pip install geopandas contextily pyproj rtree shapely mapclassify
Looking in indexes: https://pypi.org/simple, https://pypi.ngc.nvidia.com
Requirement already satisfied: geopandas in /home/daniele/.miniconda3/envs/osm/lib/python3.9/site-packages (0.12.1)
Requirement already satisfied: contextily in /home/daniele/.miniconda3/envs/osm/lib/python3.9/site-packages (1.2.0)
Requirement already satisfied: pyproj in /home/daniele/.miniconda3/envs/osm/lib/python3.9/site-packages (3.4.0)
Requirement already satisfied: rtree in /home/daniele/.miniconda3/envs/osm/lib/python3.9/site-packages (1.0.1)
Requirement already satisfied: shapely in /home/daniele/.miniconda3/envs/osm/lib/python3.9/site-packages (1.8.5.post1)
Requirement already satisfied: mapclassify in /home/daniele/.miniconda3/envs/osm/lib/python3.9/site-packages (2.4.3)
Requirement already satisfied: packaging in /home/daniele/.miniconda3/envs/osm/lib/python3.9/site-packages (from geopandas) (21.3)
Requirement already satisfied: pandas>=1.0.0 in /home/daniele/.miniconda3/envs/osm/lib/python3.9/site-packages (from geopandas) (1.5.1)
Requirement already satisfied: fiona>=1.8 in /home/daniele/.miniconda3/envs/osm/lib/python3.9/site-packages (from geopandas) (1.8.22)
Requirement already satisfied: rasterio in /home/daniele/.miniconda3/envs/osm/lib/python3.9/site-packages (from contextily) (1.3.4)
Requirement already satisfied: matplotlib in /home/daniele/.miniconda3/envs/osm/lib/python3.9/site-packages (from contextily) (3.6.2)
Requirement already satisfied: geopy in /home/daniele/.miniconda3/envs/osm/lib/python3.9/site-packages (from contextily) (2.3.0)
Requirement already satisfied: joblib in /home/daniele/.miniconda3/envs/osm/lib/python3.9/site-packages (from contextily) (1.2.0)
Requirement already satisfied: requests in /home/daniele/.miniconda3/envs/osm/lib/python3.9/site-packages (from contextily) (2.28.1)
Requirement already satisfied: mercantile in /home/daniele/.miniconda3/envs/osm/lib/python3.9/site-packages (from contextily) (1.2.1)
Requirement already satisfied: xyzservices in /home/daniele/.miniconda3/envs/osm/lib/python3.9/site-packages (from contextily) (2022.9.0)
Requirement already satisfied: pillow in /home/daniele/.miniconda3/envs/osm/lib/python3.9/site-packages (from contextily) (9.3.0)
Requirement already satisfied: certifi in /home/daniele/.miniconda3/envs/osm/lib/python3.9/site-packages (from pyproj) (2022.9.24)
Requirement already satisfied: numpy>=1.3 in /home/daniele/.miniconda3/envs/osm/lib/python3.9/site-packages (from mapclassify) (1.23.4)
Requirement already satisfied: scikit-learn in /home/daniele/.miniconda3/envs/osm/lib/python3.9/site-packages (from mapclassify) (1.1.3)
Requirement already satisfied: scipy>=1.0 in /home/daniele/.miniconda3/envs/osm/lib/python3.9/site-packages (from mapclassify) (1.9.3)
Requirement already satisfied: networkx in /home/daniele/.miniconda3/envs/osm/lib/python3.9/site-packages (from mapclassify) (2.8.8)
Requirement already satisfied: click>=4.0 in /home/daniele/.miniconda3/envs/osm/lib/python3.9/site-packages (from fiona>=1.8->geopandas) (8.1.3)
Requirement already satisfied: cligj>=0.5 in /home/daniele/.miniconda3/envs/osm/lib/python3.9/site-packages (from fiona>=1.8->geopandas) (0.7.2)
Requirement already satisfied: setuptools in /home/daniele/.miniconda3/envs/osm/lib/python3.9/site-packages (from fiona>=1.8->geopandas) (65.5.0)
Requirement already satisfied: six>=1.7 in /home/daniele/.miniconda3/envs/osm/lib/python3.9/site-packages (from fiona>=1.8->geopandas) (1.16.0)
Requirement already satisfied: attrs>=17 in /home/daniele/.miniconda3/envs/osm/lib/python3.9/site-packages (from fiona>=1.8->geopandas) (22.1.0)
Requirement already satisfied: click-plugins>=1.0 in /home/daniele/.miniconda3/envs/osm/lib/python3.9/site-packages (from fiona>=1.8->geopandas) (1.1.1)
Requirement already satisfied: munch in /home/daniele/.miniconda3/envs/osm/lib/python3.9/site-packages (from fiona>=1.8->geopandas) (2.5.0)
Requirement already satisfied: python-dateutil>=2.8.1 in /home/daniele/.miniconda3/envs/osm/lib/python3.9/site-packages (from pandas>=1.0.0->geopandas) (2.8.2)
Requirement already satisfied: pytz>=2020.1 in /home/daniele/.miniconda3/envs/osm/lib/python3.9/site-packages (from pandas>=1.0.0->geopandas) (2022.6)
Requirement already satisfied: geographiclib<3,>=1.52 in /home/daniele/.miniconda3/envs/osm/lib/python3.9/site-packages (from geopy->contextily) (2.0)
Requirement already satisfied: kiwisolver>=1.0.1 in /home/daniele/.miniconda3/envs/osm/lib/python3.9/site-packages (from matplotlib->contextily) (1.4.4)
Requirement already satisfied: pyparsing>=2.2.1 in /home/daniele/.miniconda3/envs/osm/lib/python3.9/site-packages (from matplotlib->contextily) (3.0.9)
Requirement already satisfied: contourpy>=1.0.1 in /home/daniele/.miniconda3/envs/osm/lib/python3.9/site-packages (from matplotlib->contextily) (1.0.6)
Requirement already satisfied: fonttools>=4.22.0 in /home/daniele/.miniconda3/envs/osm/lib/python3.9/site-packages (from matplotlib->contextily) (4.38.0)
Requirement already satisfied: cycler>=0.10 in /home/daniele/.miniconda3/envs/osm/lib/python3.9/site-packages (from matplotlib->contextily) (0.11.0)
Requirement already satisfied: affine in /home/daniele/.miniconda3/envs/osm/lib/python3.9/site-packages (from rasterio->contextily) (2.3.1)
Requirement already satisfied: snuggs>=1.4.1 in /home/daniele/.miniconda3/envs/osm/lib/python3.9/site-packages (from rasterio->contextily) (1.4.7)
Requirement already satisfied: idna<4,>=2.5 in /home/daniele/.miniconda3/envs/osm/lib/python3.9/site-packages (from requests->contextily) (3.4)
Requirement already satisfied: charset-normalizer<3,>=2 in /home/daniele/.miniconda3/envs/osm/lib/python3.9/site-packages (from requests->contextily) (2.1.1)
Requirement already satisfied: urllib3<1.27,>=1.21.1 in /home/daniele/.miniconda3/envs/osm/lib/python3.9/site-packages (from requests->contextily) (1.26.12)
Requirement already satisfied: threadpoolctl>=2.0.0 in /home/daniele/.miniconda3/envs/osm/lib/python3.9/site-packages (from scikit-learn->mapclassify) (3.1.0)
Note: you may need to restart the kernel to use updated packages.
In [ ]:
from pandas import merge
from geopandas import GeoDataFrame, read_file, points_from_xy
from shapely.geometry import GeometryCollection, shape, Point, MultiPolygon, LineString
from shapely.ops import polygonize
from urllib.request import urlopen, urlretrieve
from urllib.error import HTTPError
from urllib.parse import quote_plus
from os.path import exists
import contextily as cx
import json
from numpy import array
from os import system

Download municipalities and existing town halls from Overpass¶

In [ ]:
PROVINCE_OVERPASS_QUERY=f"""
[out:json][timeout:90];
area({search_area_id})->.searchArea;
relation["boundary"="administrative"]["admin_level"="6"]["ISO3166-2"!="FR-74"](area.searchArea);
convert item ::=::,::geom=geom(),_osm_type=type(),_osm_id=id();
out geom;
"""
In [ ]:
MUNICIPALITY_OVERPASS_QUERY=f"""
[out:json][timeout:90];
area({search_area_id})->.searchArea;
relation["boundary"="administrative"]["admin_level"="8"](area.searchArea);
convert item ::=::,::geom=geom(),_osm_type=type(),_osm_id=id();
out geom;
"""
In [ ]:
TOWNHALL_OVERPASS_QUERY=f"""
[out:json][timeout:90];
area({search_area_id})->.searchArea;
nwr["amenity"="townhall"](area.searchArea);
convert item ::=::,::geom=geom(),_osm_type=type(),_osm_id=id();
out geom;
"""
In [ ]:
def fetchOverpassGeoDataFrame(overpass_query, geometry_transform=shape):
    url = "https://overpass-api.de/api/interpreter?data="+quote_plus(overpass_query)
    try:
        with urlopen(url) as response:
            data = response.read()
            encoding = response.info().get_content_charset('utf-8')
            json_content = data.decode(encoding)
        if "Query timed out" in json_content:
            raise Exception("Query timed out")
        #print(json_content)
        json_object = json.loads(json_content)
        #print(json_object['elements'][0] if json_object['elements'] else "No elments")
        elements = [{
            "id": element["id"],
            "osm_id": element["tags"]["_osm_id"],
            "osm_type": element["tags"]["_osm_type"],
            "osm_url": 'https://www.openstreetmap.org/'+element["tags"]["_osm_type"]+'/'+element["tags"]["_osm_id"],
            "name": element["tags"]["name"] if "name" in element["tags"] else None,
            "geometry": geometry_transform(element['geometry'])
        } for element in json_object['elements']]
        #print(elements[0])
        # OSM uses WGS 84: https://wiki.openstreetmap.org/wiki/Converting_to_WGS84
        crs = 'EPSG:4326' # Use the SRID for WGS 84 - https://epsg.io/4326
        gdf = GeoDataFrame(elements, crs=crs)
    except HTTPError as err:
        print("Failed downloading data from Overpass, retry later")
        raise err
    except json.JSONDecodeError as err:
        print("Failed interpreting JSON data from Overpass")
        raise err
    return gdf
In [ ]:
def readOrFetchOverpassGeoDataFrame(file_path, overpass_query, geometry_transform=shape):
    if exists(file_path):
        gdf = read_file(file_path, driver='GeoJSON')
    else:
        gdf = fetchOverpassGeoDataFrame(overpass_query, geometry_transform)
        gdf.to_file(file_path, driver='GeoJSON')
    return gdf
In [ ]:
# Convert Overpass geometries into MultiPolygons - https://stackoverflow.com/a/72677231/2347196
convert_geom_to_multipolygon = lambda x: MultiPolygon(polygonize(shape(x)))
In [ ]:
province_gdf = readOrFetchOverpassGeoDataFrame(province_json_file_path, PROVINCE_OVERPASS_QUERY, convert_geom_to_multipolygon)
province_gdf.count()
Out[ ]:
id          109
osm_id      109
osm_type    109
osm_url     109
name        109
geometry    109
dtype: int64
In [ ]:
province_gdf.head()
Out[ ]:
id osm_id osm_type osm_url name geometry
0 1 39151 relation https://www.openstreetmap.org/relation/39151 Agrigento MULTIPOLYGON (((13.98219 37.19312, 13.98220 37...
1 2 39979 relation https://www.openstreetmap.org/relation/39979 Nuoro MULTIPOLYGON (((9.62535 40.25649, 9.62514 40.2...
2 3 40021 relation https://www.openstreetmap.org/relation/40021 Aristanis/Oristano MULTIPOLYGON (((8.38245 40.33860, 8.38324 40.3...
3 4 276369 relation https://www.openstreetmap.org/relation/276369 Cagliari MULTIPOLYGON (((9.16386 39.83254, 9.16450 39.8...
4 5 12998776 relation https://www.openstreetmap.org/relation/12998776 Sulcis Iglesiente MULTIPOLYGON (((8.37422 39.02318, 8.37403 39.0...
In [ ]:
municipality_gdf = readOrFetchOverpassGeoDataFrame(municipality_json_file_path, MUNICIPALITY_OVERPASS_QUERY, convert_geom_to_multipolygon)
municipality_gdf.count()
Out[ ]:
id          7903
osm_id      7903
osm_type    7903
osm_url     7903
name        7903
geometry    7903
dtype: int64
In [ ]:
municipality_gdf.head()
Out[ ]:
id osm_id osm_type osm_url name geometry
0 1 39150 relation https://www.openstreetmap.org/relation/39150 Lampedusa e Linosa MULTIPOLYGON (((12.87805 35.85517, 12.87809 35...
1 2 39777 relation https://www.openstreetmap.org/relation/39777 Santu Antiogu/Sant'Antioco MULTIPOLYGON (((8.38404 39.00591, 8.38379 39.0...
2 3 39809 relation https://www.openstreetmap.org/relation/39809 Câdesédda/Calasetta MULTIPOLYGON (((8.37490 39.10915, 8.37532 39.1...
3 4 39853 relation https://www.openstreetmap.org/relation/39853 Igrèsias/Iglesias MULTIPOLYGON (((8.43347 39.30784, 8.43347 39.3...
4 5 39915 relation https://www.openstreetmap.org/relation/39915 Bugerru/Buggerru MULTIPOLYGON (((8.41075 39.44130, 8.41059 39.4...
In [ ]:
townhall_gdf = readOrFetchOverpassGeoDataFrame(townhall_json_file_path, TOWNHALL_OVERPASS_QUERY)
townhall_gdf.count()
Out[ ]:
id          7216
osm_id      7216
osm_type    7216
osm_url     7216
name        5637
geometry    7216
dtype: int64
In [ ]:
townhall_gdf.head()
Out[ ]:
id osm_id osm_type osm_url name geometry
0 1 4492704609 node https://www.openstreetmap.org/node/4492704609 Comune di Carloforte POINT (8.30562 39.14578)
1 2 2440099045 node https://www.openstreetmap.org/node/2440099045 None POINT (8.37907 39.20365)
2 3 1853454108 node https://www.openstreetmap.org/node/1853454108 Comune di Teulada POINT (8.77381 38.96790)
3 4 5358907076 node https://www.openstreetmap.org/node/5358907076 Comune di Sant'Antioco POINT (8.45543 39.06645)
4 5 2126087185 node https://www.openstreetmap.org/node/2126087185 Comune di San Giovanni Suergiu POINT (8.52207 39.11028)
In [ ]:
from matplotlib import pyplot as plt
def show_map(geo_df:GeoDataFrame, background_gdf:GeoDataFrame=None, color_column:str=None, cmap:str=None):
    df_wm = geo_df.to_crs(epsg=3857)
    figsize=(20,10)
    fig,ax = plt.subplots(1, 1, figsize=figsize)
    legend = False
    
    if background_gdf is not None:
        background_df_wm = background_gdf.to_crs(epsg=3857)
        ax = background_df_wm.plot(ax=ax, figsize=figsize, alpha=0.3, edgecolor='k')
    
    if color_column is not None:
        legend = True
    
    ax = df_wm.plot(ax=ax, figsize=figsize, edgecolor='k', column=color_column, cmap=cmap, legend=legend)
    cx.add_basemap(ax, source=cx.providers.Stamen.TonerLite)
    cx.add_basemap(ax, source=cx.providers.Stamen.TonerLabels)

Map of municipalities available on OSM:

In [ ]:
show_map(municipality_gdf)

Map of town halls available on OSM:

In [ ]:
show_map(townhall_gdf)
#show_map(townhall_gdf, municipality_gdf)
#municipality_gdf.explore()
#townhall_gdf.explore()

Find municipalities without town halls¶

In [ ]:
with_townhall_gdf = townhall_gdf.sjoin(
        municipality_gdf,
        how="inner",
        predicate="within",
        lsuffix="hall",
        rsuffix="town"
    )
with_townhall_gdf.count()
Out[ ]:
id_hall          7222
osm_id_hall      7222
osm_type_hall    7222
osm_url_hall     7222
name_hall        5642
geometry         7222
index_town       7222
id_town          7222
osm_id_town      7222
osm_type_town    7222
osm_url_town     7222
name_town        7222
dtype: int64
In [ ]:
without_townhall_gdf = municipality_gdf[ # Anti-join
        ~municipality_gdf["id"].isin(with_townhall_gdf["id_town"])
    ]
without_townhall_gdf.to_file(without_townhall_json_file_path, driver="GeoJSON")
without_townhall_gdf.count()
Out[ ]:
id          1314
osm_id      1314
osm_type    1314
osm_url     1314
name        1314
geometry    1314
dtype: int64
In [ ]:
without_townhall_gdf.head()
Out[ ]:
id osm_id osm_type osm_url name geometry
27 28 39855 relation https://www.openstreetmap.org/relation/39855 Bidda Matzràxia/Villamassargia MULTIPOLYGON (((8.73100 39.28096, 8.73147 39.2...
44 45 39803 relation https://www.openstreetmap.org/relation/39803 Sa Baronia/Villaperuccio MULTIPOLYGON (((8.61680 39.12812, 8.61717 39.1...
185 186 12338682 relation https://www.openstreetmap.org/relation/12338682 Misiliscemi MULTIPOLYGON (((12.49852 37.96577, 12.50396 37...
426 427 40827 relation https://www.openstreetmap.org/relation/40827 Caragnani/Calangianus MULTIPOLYGON (((9.30121 40.84693, 9.30056 40.8...
453 454 40950 relation https://www.openstreetmap.org/relation/40950 Sant'Antoni di Gaddura/Sant'Antonio di Gallura MULTIPOLYGON (((9.31750 40.92267, 9.31720 40.9...

Map of municipalities without town hall:

In [ ]:
show_map(without_townhall_gdf)
#without_townhall_gdf.explore()

Calculate statistics for each province¶

In [ ]:
province_municipality_df = province_gdf[["id","geometry"]].sjoin(
        municipality_gdf[["geometry"]],
        how="left",
        predicate="contains",
        lsuffix="pro",
        rsuffix="mun"
    )
province_gdf["num_municipalities"] = province_municipality_df.groupby(province_municipality_df.index).count()["index_mun"]
In [ ]:
province_without_townhall_df = province_gdf[["id","geometry"]].sjoin(
        without_townhall_gdf[["geometry"]],
        how="left",
        predicate="contains",
        lsuffix="pro",
        rsuffix="mun"
    )
province_gdf["num_without_townhall"] = province_without_townhall_df.groupby(province_without_townhall_df.index).count()["index_mun"]
In [ ]:
province_gdf["osm_availability"] = 100 * (1 - (province_gdf["num_without_townhall"] / province_gdf["num_municipalities"]))
province_gdf["osm_availability"].hist()
Out[ ]:
<AxesSubplot: >
In [ ]:
show_map(province_gdf, None, "osm_availability", "RdYlGn")

Find OSM untagged building named as town halls¶

In [ ]:
UNTAGGED_OVERPASS_QUERY=f"""
[out:json][timeout:300];
area({search_area_id})->.searchArea;
nwr["building"]["amenity"!="townhall"]["name"~"^(\s|palazzo|del|nuovo|comune|-)*municipio",i](area.searchArea);
convert item ::=::,::geom=geom(),_osm_type=type(),_osm_id=id();
out geom;
"""
untagged_gdf = readOrFetchOverpassGeoDataFrame(untagged_json_file_path, UNTAGGED_OVERPASS_QUERY)
untagged_gdf.count()
Out[ ]:
id          30
osm_id      30
osm_type    30
osm_url     30
name        30
geometry    30
dtype: int64
In [ ]:
untagged_gdf.head()
Out[ ]:
id osm_id osm_type osm_url name geometry
0 1 277834707 way https://www.openstreetmap.org/way/277834707 Municipio di Monserrato LINESTRING (9.14363 39.25416, 9.14336 39.25394...
1 2 933053288 way https://www.openstreetmap.org/way/933053288 Municipio LINESTRING (13.09184 37.95253, 13.09212 37.952...
2 3 332108931 way https://www.openstreetmap.org/way/332108931 Municipio Roma V - Aula consigliare LINESTRING (12.54262 41.88052, 12.54278 41.880...
3 4 60145522 way https://www.openstreetmap.org/way/60145522 Municipio LINESTRING (12.95500 41.58178, 12.95523 41.581...
4 5 42089778 way https://www.openstreetmap.org/way/42089778 Municipio Frosinone LINESTRING (13.35066 41.63963, 13.35074 41.639...
In [ ]:
untagged_missing_gdf = untagged_gdf.sjoin(
        without_townhall_gdf,
        how="inner",
        predicate="within",
        lsuffix="hall",
        rsuffix="town"
    )
untagged_missing_gdf.count()
Out[ ]:
id_hall          1
osm_id_hall      1
osm_type_hall    1
osm_url_hall     1
name_hall        1
geometry         1
index_town       1
id_town          1
osm_id_town      1
osm_type_town    1
osm_url_town     1
name_town        1
dtype: int64
In [ ]:
untagged_missing_gdf.head()
Out[ ]:
id_hall osm_id_hall osm_type_hall osm_url_hall name_hall geometry index_town id_town osm_id_town osm_type_town osm_url_town name_town
10 11 672589063 way https://www.openstreetmap.org/way/672589063 Municipio di Atella di Napoli (1928-46) LINESTRING (14.26055 40.96097, 14.26056 40.961... 1834 1835 40939 relation https://www.openstreetmap.org/relation/40939 Sant'Arpino
In [ ]:
untagged_missing_gdf.to_file(untagged_missing_json_file_path, driver='GeoJSON')
In [ ]:
#show_map(untagged_missing_gdf)
untagged_missing_gdf.explore()
Out[ ]:
Make this Notebook Trusted to load map: File -> Trust Notebook

Step 2: Obtain the data from DBSN¶

Download the data from IGM DBSN ( https://www.igmi.org/it/dbsn-database-di-sintesi-nazionale ).

Then extract the catageory of elements you are interested in and save it as GeoJSON with EPSG 4326 SRID. To accomplish you can use the script "filtra_dbsn.sh" in the project repository root (or https://www.dsantini.it/dbsn/filtra_dbsn.sh ). The file downloaded below from dbsn_url has been generated with this script.

Step 3: Analyse useful data from DBSN¶

Find possible town halls from official Open Data¶

Download official open data on town halls¶

In [ ]:
def download_file_if_not_exists(file_path, url):
    if not exists(file_path):
        try: 
            urlretrieve(url, file_path)
        except HTTPError as err:
            print("Failed downloading data from Overpass, retry later")
            raise err
In [ ]:
# https://www.dsantini.it/dbsn/
dbsn_url = "https://www.dsantini.it/dbsn/notebooks/municipi.geojson"
download_file_if_not_exists(dbsn_json_file_path, dbsn_url)
In [ ]:
dbsn_gdf = read_file(dbsn_json_file_path)
dbsn_gdf.count()
Out[ ]:
edifc_uso       3552
edifc_ty        3552
edifc_sot       3552
classid         3538
edifc_nome      3551
edifc_stat      3552
edifc_at        3505
scril           3499
meta_ist        3550
edifc_mon       3552
shape_Length    3552
shape_Area      3552
geometry        3552
dtype: int64
In [ ]:
dbsn_gdf.head()
Out[ ]:
edifc_uso edifc_ty edifc_sot classid edifc_nome edifc_stat edifc_at scril meta_ist edifc_mon shape_Length shape_Area geometry
0 0201 93 93 65D8ED81-5047-4CEA-9103-AA2034B665DD Municipio di Lampedusa e Linosa 91 -9999.0 10k 04 02 66.022667 272.435503 MULTIPOLYGON Z (((12.60941 35.50254 0.00000, 1...
1 0201 93 93 D659C260-EDD5-4540-BC6C-EACB33EC447B Municipio di Licata 91 -9999.0 10k 04 02 99.677476 358.678321 MULTIPOLYGON Z (((13.93720 37.10145 0.00000, 1...
2 0201 93 93 b4949764-f626-442c-89ad-200e56ea653d Municipio di Cammarata 91 -9999.0 10k 04 02 133.927947 670.469227 MULTIPOLYGON Z (((13.63779 37.63324 0.00000, 1...
3 0201 93 93 ece5bd6f-834b-4230-a100-89232be50ff0 Municipio di San Biagio Platani 91 -9999.0 10k 04 02 134.259563 628.250694 MULTIPOLYGON Z (((13.52434 37.50919 0.00000, 1...
4 0201 93 93 7c14edd9-e910-4de2-9cb9-2cc44be6a4fc Municipio di Cianciana 91 -9999.0 10k 04 02 126.859157 633.197564 MULTIPOLYGON Z (((13.43422 37.51843 0.00000, 1...

Province statistics of Public Data¶

In [ ]:
province_dbsn_df = province_gdf[["id","geometry"]].sjoin(
        dbsn_gdf[["geometry"]],
        how="left",
        predicate="contains",
        lsuffix="pro",
        rsuffix="mun"
    )
province_gdf["num_with_dbsn_townhall"] = province_dbsn_df.groupby(province_dbsn_df.index).count()["index_mun"]
In [ ]:
province_gdf["dbsn_availability"] = 100 * (province_gdf["num_with_dbsn_townhall"] / province_gdf["num_municipalities"])
province_gdf["dbsn_availability"].hist()
Out[ ]:
<AxesSubplot: >
In [ ]:
show_map(province_gdf, None, "dbsn_availability", "RdYlGn")

Compare existing town halls from OSM and Public Data¶

In [ ]:
dbsn_existing_df = dbsn_gdf.sjoin(
        municipality_gdf,
        how="inner",
        predicate="within",
        lsuffix="dbsn",
        rsuffix="town"
    )
dbsn_existing_df.count()
Out[ ]:
edifc_uso       3557
edifc_ty        3557
edifc_sot       3557
classid         3543
edifc_nome      3556
edifc_stat      3557
edifc_at        3510
scril           3504
meta_ist        3555
edifc_mon       3557
shape_Length    3557
shape_Area      3557
geometry        3557
index_town      3557
id              3557
osm_id          3557
osm_type        3557
osm_url         3557
name            3557
dtype: int64
In [ ]:
compare_gdf = merge(
    dbsn_existing_df,
    with_townhall_gdf,
    how="inner",
    left_on="index_town",
    right_on="index_town"
)
compare_gdf.count()
Out[ ]:
edifc_uso        2972
edifc_ty         2972
edifc_sot        2972
classid          2963
edifc_nome       2971
edifc_stat       2972
edifc_at         2939
scril            2933
meta_ist         2967
edifc_mon        2972
shape_Length     2972
shape_Area       2972
geometry_x       2972
index_town       2972
id               2972
osm_id           2972
osm_type         2972
osm_url          2972
name             2972
id_hall          2972
osm_id_hall      2972
osm_type_hall    2972
osm_url_hall     2972
name_hall        2395
geometry_y       2972
id_town          2972
osm_id_town      2972
osm_type_town    2972
osm_url_town     2972
name_town        2972
dtype: int64
In [ ]:
compare_gdf["distance"] = compare_gdf["geometry_x"].to_crs(epsg=3857).distance(compare_gdf["geometry_y"].to_crs(epsg=3857))
compare_gdf["geometry"] = compare_gdf.apply(
      lambda row: GeometryCollection([
          row['geometry_x'],
          LineString([row['geometry_x'].centroid, row['geometry_y'].centroid]),
          row['geometry_y']
        ]),
      axis=1
    ).set_crs(epsg=4326)
/home/daniele/.miniconda3/envs/osm/lib/python3.9/site-packages/pandas/core/dtypes/inference.py:387: ShapelyDeprecationWarning: Iteration over multi-part geometries is deprecated and will be removed in Shapely 2.0. Use the `geoms` property to access the constituent parts of a multi-part geometry.
  iter(obj)  # Can iterate over it.
/home/daniele/.miniconda3/envs/osm/lib/python3.9/site-packages/pandas/core/dtypes/inference.py:388: ShapelyDeprecationWarning: __len__ for multi-part geometries is deprecated and will be removed in Shapely 2.0. Check the length of the `geoms` property instead to get the  number of parts of a multi-part geometry.
  len(obj)  # Has a length associated with it.
/home/daniele/.miniconda3/envs/osm/lib/python3.9/site-packages/pandas/core/dtypes/cast.py:1784: ShapelyDeprecationWarning: __len__ for multi-part geometries is deprecated and will be removed in Shapely 2.0. Check the length of the `geoms` property instead to get the  number of parts of a multi-part geometry.
  result[:] = values
In [ ]:
compare_gdf.hist(log=True, column="distance")
Out[ ]:
array([[<AxesSubplot: title={'center': 'distance'}>]], dtype=object)
In [ ]:
conflict_mask=compare_gdf["distance"] > 5000
for word in ["delegazione","circoscrizione","quartiere","municipalità","municipio roma","consorzio"]:
    conflict_mask &= ~(compare_gdf["name_hall"].str.lower().str.contains(word, na=False))
conflict_mask.value_counts()
Out[ ]:
False    2924
True       48
Name: distance, dtype: int64
In [ ]:
dbsn_conflict_gdf = compare_gdf[conflict_mask]
dbsn_conflict_gdf.count()
Out[ ]:
edifc_uso        48
edifc_ty         48
edifc_sot        48
classid          48
edifc_nome       48
edifc_stat       48
edifc_at         47
scril            47
meta_ist         48
edifc_mon        48
shape_Length     48
shape_Area       48
geometry_x       48
index_town       48
id               48
osm_id           48
osm_type         48
osm_url          48
name             48
id_hall          48
osm_id_hall      48
osm_type_hall    48
osm_url_hall     48
name_hall        29
geometry_y       48
id_town          48
osm_id_town      48
osm_type_town    48
osm_url_town     48
name_town        48
distance         48
geometry         48
dtype: int64
In [ ]:
dbsn_conflict_gdf.explore()
/home/daniele/.miniconda3/envs/osm/lib/python3.9/site-packages/folium/features.py:907: UserWarning: GeoJsonTooltip is not configured to render for GeoJson GeometryCollection geometries. Please consider reworking these features: [{'edifc_uso': '0201', 'edifc_ty': '01', 'edifc_sot': '01', 'classid': 'RT0201020000715890', 'edifc_nome': 'MUNICIPIO DI LATERINA PERGINE VALDARNO', 'edifc_stat': '03', 'edifc_at': -9999.0, 'scril': '10k', 'meta_ist': '02', 'edifc_mon': '02', 'shape_Length': 64.58745639571208, 'shape_Area': 256.7064503772148, 'index_town': 6108, 'id': 6109, 'osm_id': '7857598', 'osm_type': 'relation', 'osm_url': 'https://www.openstreetmap.org/relation/7857598', 'name': 'Laterina Pergine Valdarno', 'id_hall': 5956, 'osm_id_hall': '720528407', 'osm_type_hall': 'way', 'osm_url_hall': 'https://www.openstreetmap.org/way/720528407', 'name_hall': 'Municipio', 'id_town': 6109, 'osm_id_town': '7857598', 'osm_type_town': 'relation', 'osm_url_town': 'https://www.openstreetmap.org/relation/7857598', 'name_town': 'Laterina Pergine Valdarno', 'distance': 6278.304052266977}, {'edifc_uso': '0201', 'edifc_ty': '01', 'edifc_sot': '01', 'classid': '97e6fc96-4514-43ec-9b09-f96ec16121da', 'edifc_nome': 'MUNICIPIO DI BARI', 'edifc_stat': '03', 'edifc_at': -9999.0, 'scril': '5000', 'meta_ist': '04', 'edifc_mon': '02', 'shape_Length': 201.59782739982984, 'shape_Area': 1226.086483352691, 'index_town': 2537, 'id': 2538, 'osm_id': '41038', 'osm_type': 'relation', 'osm_url': 'https://www.openstreetmap.org/relation/41038', 'name': 'Bari', 'id_hall': 846, 'osm_id_hall': '5228480239', 'osm_type_hall': 'node', 'osm_url_hall': 'https://www.openstreetmap.org/node/5228480239', 'name_hall': 'Municipio di Carbonara', 'id_town': 2538, 'osm_id_town': '41038', 'osm_type_town': 'relation', 'osm_url_town': 'https://www.openstreetmap.org/relation/41038', 'name_town': 'Bari', 'distance': 7999.057309449549}, {'edifc_uso': '0201', 'edifc_ty': '01', 'edifc_sot': '01', 'classid': 'e0ecd80a-9f8d-4a2d-a073-af43271a01df', 'edifc_nome': 'MUNICIPIO DI SELARGIUS', 'edifc_stat': '03', 'edifc_at': -9999.0, 'scril': 'MAURO', 'meta_ist': '04', 'edifc_mon': '02', 'shape_Length': 255.43204452306276, 'shape_Area': 1300.3036330729328, 'index_town': 60, 'id': 61, 'osm_id': '39870', 'osm_type': 'relation', 'osm_url': 'https://www.openstreetmap.org/relation/39870', 'name': 'Ceraxus/Selargius', 'id_hall': 2746, 'osm_id_hall': '278321497', 'osm_type_hall': 'way', 'osm_url_hall': 'https://www.openstreetmap.org/way/278321497', 'name_hall': None, 'id_town': 61, 'osm_id_town': '39870', 'osm_type_town': 'relation', 'osm_url_town': 'https://www.openstreetmap.org/relation/39870', 'name_town': 'Ceraxus/Selargius', 'distance': 6395.788116005456}, {'edifc_uso': '0201', 'edifc_ty': '01', 'edifc_sot': '01', 'classid': 'fe6832dd-fcec-4eb4-b24b-57958e2049a8', 'edifc_nome': 'MUNICIPIO DI FRANCOLISE', 'edifc_stat': '03', 'edifc_at': -9999.0, 'scril': '5000', 'meta_ist': '04', 'edifc_mon': '02', 'shape_Length': 76.5775103475089, 'shape_Area': 311.75, 'index_town': 1804, 'id': 1805, 'osm_id': '41106', 'osm_type': 'relation', 'osm_url': 'https://www.openstreetmap.org/relation/41106', 'name': 'Francolise', 'id_hall': 537, 'osm_id_hall': '4454977022', 'osm_type_hall': 'node', 'osm_url_hall': 'https://www.openstreetmap.org/node/4454977022', 'name_hall': None, 'id_town': 1805, 'osm_id_town': '41106', 'osm_type_town': 'relation', 'osm_url_town': 'https://www.openstreetmap.org/relation/41106', 'name_town': 'Francolise', 'distance': 6239.3883480742725}, {'edifc_uso': '0201', 'edifc_ty': '01', 'edifc_sot': '01', 'classid': '7227d989-48d2-4d6e-93b9-379c80adcdb7', 'edifc_nome': 'COMUNE DI CORIGLIANO - ROSSANO', 'edifc_stat': '03', 'edifc_at': -9999.0, 'scril': '5000', 'meta_ist': '04', 'edifc_mon': '02', 'shape_Length': 197.53872143966785, 'shape_Area': 1113.715674915214, 'index_town': 1580, 'id': 1581, 'osm_id': '8164150', 'osm_type': 'relation', 'osm_url': 'https://www.openstreetmap.org/relation/8164150', 'name': 'Corigliano-Rossano', 'id_hall': 3628, 'osm_id_hall': '1074341706', 'osm_type_hall': 'way', 'osm_url_hall': 'https://www.openstreetmap.org/way/1074341706', 'name_hall': None, 'id_town': 1581, 'osm_id_town': '8164150', 'osm_type_town': 'relation', 'osm_url_town': 'https://www.openstreetmap.org/relation/8164150', 'name_town': 'Corigliano-Rossano', 'distance': 13024.946016424186}, {'edifc_uso': '0201', 'edifc_ty': '01', 'edifc_sot': '01', 'classid': '92570fc3-edf9-4fee-acbc-a36d4a4d8ecd', 'edifc_nome': 'Comune  di Tortora', 'edifc_stat': '03', 'edifc_at': -9999.0, 'scril': '5000', 'meta_ist': '04', 'edifc_mon': '02', 'shape_Length': 141.43474295664427, 'shape_Area': 705.3583554063932, 'index_town': 2283, 'id': 2284, 'osm_id': '40149', 'osm_type': 'relation', 'osm_url': 'https://www.openstreetmap.org/relation/40149', 'name': 'Tortora', 'id_hall': 622, 'osm_id_hall': '3134845137', 'osm_type_hall': 'node', 'osm_url_hall': 'https://www.openstreetmap.org/node/3134845137', 'name_hall': None, 'id_town': 2284, 'osm_id_town': '40149', 'osm_type_town': 'relation', 'osm_url_town': 'https://www.openstreetmap.org/relation/40149', 'name_town': 'Tortora', 'distance': 5078.286807386132}, {'edifc_uso': '0201', 'edifc_ty': '01', 'edifc_sot': '93', 'classid': '81454799-78b9-45a2-bc18-7ab0cc1c7e10', 'edifc_nome': 'Comune di Maletto', 'edifc_stat': '91', 'edifc_at': -9999.0, 'scril': '10k', 'meta_ist': '04', 'edifc_mon': '02', 'shape_Length': 207.0690288027073, 'shape_Area': 1026.026198711314, 'index_town': 1151, 'id': 1152, 'osm_id': '39339', 'osm_type': 'relation', 'osm_url': 'https://www.openstreetmap.org/relation/39339', 'name': 'Bronte', 'id_hall': 353, 'osm_id_hall': '5762223137', 'osm_type_hall': 'node', 'osm_url_hall': 'https://www.openstreetmap.org/node/5762223137', 'name_hall': 'Municipio di Bronte', 'id_town': 1152, 'osm_id_town': '39339', 'osm_type_town': 'relation', 'osm_url_town': 'https://www.openstreetmap.org/relation/39339', 'name_town': 'Bronte', 'distance': 7134.410378895383}, {'edifc_uso': '0201', 'edifc_ty': '01', 'edifc_sot': '93', 'classid': '3c48ef63-fd6f-4bd6-b186-bf7f5607e594', 'edifc_nome': 'Comune di Bronte', 'edifc_stat': '91', 'edifc_at': -9999.0, 'scril': '10k', 'meta_ist': '04', 'edifc_mon': '02', 'shape_Length': 128.0580496696216, 'shape_Area': 675.4570780407222, 'index_town': 1151, 'id': 1152, 'osm_id': '39339', 'osm_type': 'relation', 'osm_url': 'https://www.openstreetmap.org/relation/39339', 'name': 'Bronte', 'id_hall': 355, 'osm_id_hall': '8306481422', 'osm_type_hall': 'node', 'osm_url_hall': 'https://www.openstreetmap.org/node/8306481422', 'name_hall': 'Municipio di Maletto', 'id_town': 1152, 'osm_id_town': '39339', 'osm_type_town': 'relation', 'osm_url_town': 'https://www.openstreetmap.org/relation/39339', 'name_town': 'Bronte', 'distance': 7151.1235852044}, {'edifc_uso': '0201', 'edifc_ty': '01', 'edifc_sot': '01', 'classid': '3281bd4e-421d-43d9-a196-9da53075e0e0', 'edifc_nome': 'COMUNE DI MAIDA', 'edifc_stat': '03', 'edifc_at': -9999.0, 'scril': '5000', 'meta_ist': '04', 'edifc_mon': '02', 'shape_Length': 159.69619890959643, 'shape_Area': 829.6793426125863, 'index_town': 1396, 'id': 1397, 'osm_id': '39730', 'osm_type': 'relation', 'osm_url': 'https://www.openstreetmap.org/relation/39730', 'name': 'Maida', 'id_hall': 473, 'osm_id_hall': '2595081061', 'osm_type_hall': 'node', 'osm_url_hall': 'https://www.openstreetmap.org/node/2595081061', 'name_hall': None, 'id_town': 1397, 'osm_id_town': '39730', 'osm_type_town': 'relation', 'osm_url_town': 'https://www.openstreetmap.org/relation/39730', 'name_town': 'Maida', 'distance': 6549.551880089615}, {'edifc_uso': '0201', 'edifc_ty': '01', 'edifc_sot': '01', 'classid': '1ca0e797-f108-484f-bb87-7896fdd467b8', 'edifc_nome': 'COMUNE DI SANTA CATERINA DELLO IONIO', 'edifc_stat': '03', 'edifc_at': -9999.0, 'scril': '5000', 'meta_ist': '04', 'edifc_mon': '02', 'shape_Length': 83.51273506974411, 'shape_Area': 364.3087969445395, 'index_town': 1448, 'id': 1449, 'osm_id': '39652', 'osm_type': 'relation', 'osm_url': 'https://www.openstreetmap.org/relation/39652', 'name': 'Santa Caterina dello Ionio', 'id_hall': 3484, 'osm_id_hall': '323988826', 'osm_type_hall': 'way', 'osm_url_hall': 'https://www.openstreetmap.org/way/323988826', 'name_hall': 'Santa Ceterina dello Ionio', 'id_town': 1449, 'osm_id_town': '39652', 'osm_type_town': 'relation', 'osm_url_town': 'https://www.openstreetmap.org/relation/39652', 'name_town': 'Santa Caterina dello Ionio', 'distance': 5494.316614212414}, {'edifc_uso': '0201', 'edifc_ty': '01', 'edifc_sot': '01', 'classid': 'RT0201020000629195', 'edifc_nome': 'MUNICIPIO DI VINCI', 'edifc_stat': '03', 'edifc_at': -9999.0, 'scril': '10k', 'meta_ist': '02', 'edifc_mon': '02', 'shape_Length': 77.43448783183332, 'shape_Area': 231.9928454611825, 'index_town': 6059, 'id': 6060, 'osm_id': '42603', 'osm_type': 'relation', 'osm_url': 'https://www.openstreetmap.org/relation/42603', 'name': 'Vinci', 'id_hall': 1921, 'osm_id_hall': '5270684293', 'osm_type_hall': 'node', 'osm_url_hall': 'https://www.openstreetmap.org/node/5270684293', 'name_hall': None, 'id_town': 6060, 'osm_id_town': '42603', 'osm_type_town': 'relation', 'osm_url_town': 'https://www.openstreetmap.org/relation/42603', 'name_town': 'Vinci', 'distance': 9919.928065088572}, {'edifc_uso': '0201', 'edifc_ty': '01', 'edifc_sot': '01', 'classid': 'RT0201020000289856', 'edifc_nome': 'MUNICIPIO DI FIGLINE E INCISA VALDARNO', 'edifc_stat': '03', 'edifc_at': -9999.0, 'scril': '10k', 'meta_ist': '02', 'edifc_mon': '02', 'shape_Length': 107.39085027873244, 'shape_Area': 546.4965277178756, 'index_town': 6112, 'id': 6113, 'osm_id': '42520', 'osm_type': 'relation', 'osm_url': 'https://www.openstreetmap.org/relation/42520', 'name': 'Figline e Incisa Valdarno', 'id_hall': 5983, 'osm_id_hall': '242376583', 'osm_type_hall': 'way', 'osm_url_hall': 'https://www.openstreetmap.org/way/242376583', 'name_hall': 'Municipio', 'id_town': 6113, 'osm_id_town': '42520', 'osm_type_town': 'relation', 'osm_url_town': 'https://www.openstreetmap.org/relation/42520', 'name_town': 'Figline e Incisa Valdarno', 'distance': 7366.065686400814}, {'edifc_uso': '0201', 'edifc_ty': '01', 'edifc_sot': '01', 'classid': '09c35b86-538b-4be2-a1d3-e83c6bd050f2', 'edifc_nome': 'COMUNE DI CUTRO', 'edifc_stat': '03', 'edifc_at': -9999.0, 'scril': '5000', 'meta_ist': '04', 'edifc_mon': '02', 'shape_Length': 81.27736299181694, 'shape_Area': 332.05463899363286, 'index_town': 1673, 'id': 1674, 'osm_id': '39749', 'osm_type': 'relation', 'osm_url': 'https://www.openstreetmap.org/relation/39749', 'name': 'Cutro', 'id_hall': 497, 'osm_id_hall': '8050983505', 'osm_type_hall': 'node', 'osm_url_hall': 'https://www.openstreetmap.org/node/8050983505', 'name_hall': 'COmune di Cutro', 'id_town': 1674, 'osm_id_town': '39749', 'osm_type_town': 'relation', 'osm_url_town': 'https://www.openstreetmap.org/relation/39749', 'name_town': 'Cutro', 'distance': 11518.473984595968}, {'edifc_uso': '0201', 'edifc_ty': '01', 'edifc_sot': '01', 'classid': 'd1fffd02-3b4b-4c33-a1db-be458603d6b4', 'edifc_nome': 'MUNICIPIO DI SURBO', 'edifc_stat': '03', 'edifc_at': -9999.0, 'scril': '5000', 'meta_ist': '04', 'edifc_mon': '02', 'shape_Length': 148.6617042368366, 'shape_Area': 616.9038617069925, 'index_town': 3168, 'id': 3169, 'osm_id': '40442', 'osm_type': 'relation', 'osm_url': 'https://www.openstreetmap.org/relation/40442', 'name': 'Lecce', 'id_hall': 4258, 'osm_id_hall': '299718736', 'osm_type_hall': 'way', 'osm_url_hall': 'https://www.openstreetmap.org/way/299718736', 'name_hall': 'Municipio di Lecce', 'id_town': 3169, 'osm_id_town': '40442', 'osm_type_town': 'relation', 'osm_url_town': 'https://www.openstreetmap.org/relation/40442', 'name_town': 'Lecce', 'distance': 7576.214594928727}, {'edifc_uso': '0201', 'edifc_ty': '01', 'edifc_sot': '01', 'classid': 'RT0201020000896396', 'edifc_nome': 'MUNICIPIO DI ROSIGNANO MARITTIMO', 'edifc_stat': '03', 'edifc_at': -9999.0, 'scril': '10k', 'meta_ist': '0101', 'edifc_mon': '02', 'shape_Length': 233.34211273868104, 'shape_Area': 1246.5702372201276, 'index_town': 6005, 'id': 6006, 'osm_id': '42430', 'osm_type': 'relation', 'osm_url': 'https://www.openstreetmap.org/relation/42430', 'name': 'Rosignano Marittimo', 'id_hall': 1895, 'osm_id_hall': '7826967780', 'osm_type_hall': 'node', 'osm_url_hall': 'https://www.openstreetmap.org/node/7826967780', 'name_hall': None, 'id_town': 6006, 'osm_id_town': '42430', 'osm_type_town': 'relation', 'osm_url_town': 'https://www.openstreetmap.org/relation/42430', 'name_town': 'Rosignano Marittimo', 'distance': 10954.269695203871}, {'edifc_uso': '0201', 'edifc_ty': '01', 'edifc_sot': '01', 'classid': 'RT0201020000896396', 'edifc_nome': 'MUNICIPIO DI ROSIGNANO MARITTIMO', 'edifc_stat': '03', 'edifc_at': -9999.0, 'scril': '10k', 'meta_ist': '0101', 'edifc_mon': '02', 'shape_Length': 233.34211273868104, 'shape_Area': 1246.5702372201276, 'index_town': 6005, 'id': 6006, 'osm_id': '42430', 'osm_type': 'relation', 'osm_url': 'https://www.openstreetmap.org/relation/42430', 'name': 'Rosignano Marittimo', 'id_hall': 1896, 'osm_id_hall': '9140476896', 'osm_type_hall': 'node', 'osm_url_hall': 'https://www.openstreetmap.org/node/9140476896', 'name_hall': 'Consiglio di Frazione Gabbro', 'id_town': 6006, 'osm_id_town': '42430', 'osm_type_town': 'relation', 'osm_url_town': 'https://www.openstreetmap.org/relation/42430', 'name_town': 'Rosignano Marittimo', 'distance': 12266.474553244101}, {'edifc_uso': '0201', 'edifc_ty': '01', 'edifc_sot': '01', 'classid': 'd42a9ff0-57f0-4b2c-8b20-01686be6bd96', 'edifc_nome': 'MUNICIPIO DI SAN FELICE CIRCEO ', 'edifc_stat': '03', 'edifc_at': -9999.0, 'scril': '5k', 'meta_ist': '04', 'edifc_mon': '02', 'shape_Length': 78.9163991924586, 'shape_Area': 282.1693185758222, 'index_town': 474, 'id': 475, 'osm_id': '41184', 'osm_type': 'relation', 'osm_url': 'https://www.openstreetmap.org/relation/41184', 'name': 'San Felice Circeo', 'id_hall': 3079, 'osm_id_hall': '591024771', 'osm_type_hall': 'way', 'osm_url_hall': 'https://www.openstreetmap.org/way/591024771', 'name_hall': 'Comune di San Felice Circeo - Sede distaccata di Borgo Montenero', 'id_town': 475, 'osm_id_town': '41184', 'osm_type_town': 'relation', 'osm_url_town': 'https://www.openstreetmap.org/relation/41184', 'name_town': 'San Felice Circeo', 'distance': 6503.997566861}, {'edifc_uso': '0201', 'edifc_ty': '01', 'edifc_sot': '01', 'classid': '3c5ad69b-f4e3-481c-aa3f-e236e617905b', 'edifc_nome': 'MUNICIPIO DI PRIVERNO ', 'edifc_stat': '03', 'edifc_at': -9999.0, 'scril': '5k', 'meta_ist': '04', 'edifc_mon': '02', 'shape_Length': 107.60295189978697, 'shape_Area': 614.2327156071351, 'index_town': 479, 'id': 480, 'osm_id': '41300', 'osm_type': 'relation', 'osm_url': 'https://www.openstreetmap.org/relation/41300', 'name': 'Priverno', 'id_hall': 79, 'osm_id_hall': '4671049020', 'osm_type_hall': 'node', 'osm_url_hall': 'https://www.openstreetmap.org/node/4671049020', 'name_hall': None, 'id_town': 480, 'osm_id_town': '41300', 'osm_type_town': 'relation', 'osm_url_town': 'https://www.openstreetmap.org/relation/41300', 'name_town': 'Priverno', 'distance': 5403.531779290544}, {'edifc_uso': '0201', 'edifc_ty': '01', 'edifc_sot': '01', 'classid': 'RT0201020000499513', 'edifc_nome': 'MUNICIPIO DI MASSAROSA', 'edifc_stat': '03', 'edifc_at': -9999.0, 'scril': '10k', 'meta_ist': '02', 'edifc_mon': '02', 'shape_Length': 98.91148379147373, 'shape_Area': 534.8884677395195, 'index_town': 6000, 'id': 6001, 'osm_id': '42665', 'osm_type': 'relation', 'osm_url': 'https://www.openstreetmap.org/relation/42665', 'name': 'Massarosa', 'id_hall': 1903, 'osm_id_hall': '1981684530', 'osm_type_hall': 'node', 'osm_url_hall': 'https://www.openstreetmap.org/node/1981684530', 'name_hall': 'Centro Culturale Villa Gori', 'id_town': 6001, 'osm_id_town': '42665', 'osm_type_town': 'relation', 'osm_url_town': 'https://www.openstreetmap.org/relation/42665', 'name_town': 'Massarosa', 'distance': 5175.4881655420595}, {'edifc_uso': '0201', 'edifc_ty': '01', 'edifc_sot': '01', 'classid': 'RT0201020000100684', 'edifc_nome': 'MUNICIPIO DI FABBRICHE DI VERGEMOLI', 'edifc_stat': '03', 'edifc_at': -9999.0, 'scril': '10k', 'meta_ist': '02', 'edifc_mon': '02', 'shape_Length': 88.2791671295131, 'shape_Area': 330.79989696952276, 'index_town': 6041, 'id': 6042, 'osm_id': '42795', 'osm_type': 'relation', 'osm_url': 'https://www.openstreetmap.org/relation/42795', 'name': 'Fabbriche di Vergemoli', 'id_hall': 5900, 'osm_id_hall': '422951429', 'osm_type_hall': 'way', 'osm_url_hall': 'https://www.openstreetmap.org/way/422951429', 'name_hall': None, 'id_town': 6042, 'osm_id_town': '42795', 'osm_type_town': 'relation', 'osm_url_town': 'https://www.openstreetmap.org/relation/42795', 'name_town': 'Fabbriche di Vergemoli', 'distance': 9906.655549764842}, {'edifc_uso': '0201', 'edifc_ty': '01', 'edifc_sot': '01', 'classid': '7B9F1DE6-F98C-4467-81AF-6A1B86C89FF5', 'edifc_nome': 'MUNICIPIO DI NAPOLI', 'edifc_stat': '03', 'edifc_at': -9999.0, 'scril': '5000', 'meta_ist': '04', 'edifc_mon': '02', 'shape_Length': 295.69130412805356, 'shape_Area': 1933.5, 'index_town': 1791, 'id': 1792, 'osm_id': '40767', 'osm_type': 'relation', 'osm_url': 'https://www.openstreetmap.org/relation/40767', 'name': 'Napoli', 'id_hall': 547, 'osm_id_hall': '1487623079', 'osm_type_hall': 'node', 'osm_url_hall': 'https://www.openstreetmap.org/node/1487623079', 'name_hall': None, 'id_town': 1792, 'osm_id_town': '40767', 'osm_type_town': 'relation', 'osm_url_town': 'https://www.openstreetmap.org/relation/40767', 'name_town': 'Napoli', 'distance': 7307.626627862197}, {'edifc_uso': '0201', 'edifc_ty': '01', 'edifc_sot': '01', 'classid': '7B9F1DE6-F98C-4467-81AF-6A1B86C89FF5', 'edifc_nome': 'MUNICIPIO DI NAPOLI', 'edifc_stat': '03', 'edifc_at': -9999.0, 'scril': '5000', 'meta_ist': '04', 'edifc_mon': '02', 'shape_Length': 295.69130412805356, 'shape_Area': 1933.5, 'index_town': 1791, 'id': 1792, 'osm_id': '40767', 'osm_type': 'relation', 'osm_url': 'https://www.openstreetmap.org/relation/40767', 'name': 'Napoli', 'id_hall': 548, 'osm_id_hall': '1502292797', 'osm_type_hall': 'node', 'osm_url_hall': 'https://www.openstreetmap.org/node/1502292797', 'name_hall': None, 'id_town': 1792, 'osm_id_town': '40767', 'osm_type_town': 'relation', 'osm_url_town': 'https://www.openstreetmap.org/relation/40767', 'name_town': 'Napoli', 'distance': 8317.0443739909}, {'edifc_uso': '0201', 'edifc_ty': '01', 'edifc_sot': '01', 'classid': '8a5754a5-205c-41c1-bc36-557cefbb68f9', 'edifc_nome': 'UNK', 'edifc_stat': '03', 'edifc_at': -9999.0, 'scril': '10k', 'meta_ist': '04', 'edifc_mon': '02', 'shape_Length': 72.0443659481572, 'shape_Area': 243.1171097181932, 'index_town': 398, 'id': 399, 'osm_id': '40187', 'osm_type': 'relation', 'osm_url': 'https://www.openstreetmap.org/relation/40187', 'name': 'Baunei', 'id_hall': 3023, 'osm_id_hall': '166062884', 'osm_type_hall': 'way', 'osm_url_hall': 'https://www.openstreetmap.org/way/166062884', 'name_hall': 'Santa Lucia e San Giovanni Eltili', 'id_town': 399, 'osm_id_town': '40187', 'osm_type_town': 'relation', 'osm_url_town': 'https://www.openstreetmap.org/relation/40187', 'name_town': 'Baunei', 'distance': 12752.569906945588}, {'edifc_uso': '0201', 'edifc_ty': '93', 'edifc_sot': '93', 'classid': '2a4ab337-e334-4598-b996-e5b10cc7ad14', 'edifc_nome': 'MUNICIPIO DI SAN CIPIRELLO', 'edifc_stat': '91', 'edifc_at': -9999.0, 'scril': '10k', 'meta_ist': '04', 'edifc_mon': '02', 'shape_Length': 108.12767495130073, 'shape_Area': 568.2592910844775, 'index_town': 196, 'id': 197, 'osm_id': '39366', 'osm_type': 'relation', 'osm_url': 'https://www.openstreetmap.org/relation/39366', 'name': 'Monreale', 'id_hall': 2872, 'osm_id_hall': '153225657', 'osm_type_hall': 'way', 'osm_url_hall': 'https://www.openstreetmap.org/way/153225657', 'name_hall': 'Municipio di Monreale', 'id_town': 197, 'osm_id_town': '39366', 'osm_type_town': 'relation', 'osm_url_town': 'https://www.openstreetmap.org/relation/39366', 'name_town': 'Monreale', 'distance': 21142.838024365257}, {'edifc_uso': '0201', 'edifc_ty': '93', 'edifc_sot': '93', 'classid': '2c05dd62-1686-40d0-886e-ab9052d3bc44', 'edifc_nome': 'MUNICIPIO DI SAN GIUSEPPE JATO', 'edifc_stat': '91', 'edifc_at': -9999.0, 'scril': '10k', 'meta_ist': '04', 'edifc_mon': '02', 'shape_Length': 67.13462396467162, 'shape_Area': 254.54515734227476, 'index_town': 196, 'id': 197, 'osm_id': '39366', 'osm_type': 'relation', 'osm_url': 'https://www.openstreetmap.org/relation/39366', 'name': 'Monreale', 'id_hall': 2872, 'osm_id_hall': '153225657', 'osm_type_hall': 'way', 'osm_url_hall': 'https://www.openstreetmap.org/way/153225657', 'name_hall': 'Municipio di Monreale', 'id_town': 197, 'osm_id_town': '39366', 'osm_type_town': 'relation', 'osm_url_town': 'https://www.openstreetmap.org/relation/39366', 'name_town': 'Monreale', 'distance': 19913.406342267554}, {'edifc_uso': '0201', 'edifc_ty': '93', 'edifc_sot': '93', 'classid': 'ad9fe6e1-1fca-4a06-977c-ccb4ec209e61', 'edifc_nome': 'MUNICIPIO DI MONREALE', 'edifc_stat': '03', 'edifc_at': -9999.0, 'scril': '10k', 'meta_ist': '04', 'edifc_mon': '02', 'shape_Length': 122.59806390625269, 'shape_Area': 525.1578215984804, 'index_town': 196, 'id': 197, 'osm_id': '39366', 'osm_type': 'relation', 'osm_url': 'https://www.openstreetmap.org/relation/39366', 'name': 'Monreale', 'id_hall': 49, 'osm_id_hall': '3874600961', 'osm_type_hall': 'node', 'osm_url_hall': 'https://www.openstreetmap.org/node/3874600961', 'name_hall': 'Municipio di San Cipirello', 'id_town': 197, 'osm_id_town': '39366', 'osm_type_town': 'relation', 'osm_url_town': 'https://www.openstreetmap.org/relation/39366', 'name_town': 'Monreale', 'distance': 21165.6948310037}, {'edifc_uso': '0201', 'edifc_ty': '93', 'edifc_sot': '93', 'classid': 'ad9fe6e1-1fca-4a06-977c-ccb4ec209e61', 'edifc_nome': 'MUNICIPIO DI MONREALE', 'edifc_stat': '03', 'edifc_at': -9999.0, 'scril': '10k', 'meta_ist': '04', 'edifc_mon': '02', 'shape_Length': 122.59806390625269, 'shape_Area': 525.1578215984804, 'index_town': 196, 'id': 197, 'osm_id': '39366', 'osm_type': 'relation', 'osm_url': 'https://www.openstreetmap.org/relation/39366', 'name': 'Monreale', 'id_hall': 50, 'osm_id_hall': '6859172613', 'osm_type_hall': 'node', 'osm_url_hall': 'https://www.openstreetmap.org/node/6859172613', 'name_hall': 'Municipio di San Giuseppe Jato', 'id_town': 197, 'osm_id_town': '39366', 'osm_type_town': 'relation', 'osm_url_town': 'https://www.openstreetmap.org/relation/39366', 'name_town': 'Monreale', 'distance': 19920.59875135371}, {'edifc_uso': '0201', 'edifc_ty': '01', 'edifc_sot': '01', 'classid': '7f3a25c5-6640-4431-bb1d-821a283f553f', 'edifc_nome': 'Municipio di Manoppello', 'edifc_stat': '03', 'edifc_at': -9999.0, 'scril': '5000', 'meta_ist': '10', 'edifc_mon': '02', 'shape_Length': 99.16114340976397, 'shape_Area': 462.7210548196189, 'index_town': 2578, 'id': 2579, 'osm_id': '41908', 'osm_type': 'relation', 'osm_url': 'https://www.openstreetmap.org/relation/41908', 'name': 'Manoppello', 'id_hall': 731, 'osm_id_hall': '1781387329', 'osm_type_hall': 'node', 'osm_url_hall': 'https://www.openstreetmap.org/node/1781387329', 'name_hall': 'Municipio', 'id_town': 2579, 'osm_id_town': '41908', 'osm_type_town': 'relation', 'osm_url_town': 'https://www.openstreetmap.org/relation/41908', 'name_town': 'Manoppello', 'distance': 7039.762020765335}, {'edifc_uso': '0201', 'edifc_ty': '01', 'edifc_sot': '01', 'classid': 'DB2AEEC5-1D85-4B6D-AE7D-26160945EFAB', 'edifc_nome': 'Municipio di Gubbio', 'edifc_stat': '03', 'edifc_at': None, 'scril': None, 'meta_ist': '02', 'edifc_mon': '02', 'shape_Length': 132.79283643444828, 'shape_Area': 806.5115123933504, 'index_town': 842, 'id': 843, 'osm_id': '42390', 'osm_type': 'relation', 'osm_url': 'https://www.openstreetmap.org/relation/42390', 'name': 'Gubbio', 'id_hall': 2092, 'osm_id_hall': '1606927652', 'osm_type_hall': 'node', 'osm_url_hall': 'https://www.openstreetmap.org/node/1606927652', 'name_hall': "Sant'Andrea del Calcinaro", 'id_town': 843, 'osm_id_town': '42390', 'osm_type_town': 'relation', 'osm_url_town': 'https://www.openstreetmap.org/relation/42390', 'name_town': 'Gubbio', 'distance': 9493.356874954596}, {'edifc_uso': '0201', 'edifc_ty': '01', 'edifc_sot': '01', 'classid': 'RT0201020000211931', 'edifc_nome': 'MUNICIPIO DI CRESPINA LORENZANA', 'edifc_stat': '03', 'edifc_at': -9999.0, 'scril': '10k', 'meta_ist': '02', 'edifc_mon': '02', 'shape_Length': 60.27327389966199, 'shape_Area': 175.64103500795332, 'index_town': 6021, 'id': 6022, 'osm_id': '42509', 'osm_type': 'relation', 'osm_url': 'https://www.openstreetmap.org/relation/42509', 'name': 'Crespina Lorenzana', 'id_hall': 5880, 'osm_id_hall': '704361657', 'osm_type_hall': 'way', 'osm_url_hall': 'https://www.openstreetmap.org/way/704361657', 'name_hall': None, 'id_town': 6022, 'osm_id_town': '42509', 'osm_type_town': 'relation', 'osm_url_town': 'https://www.openstreetmap.org/relation/42509', 'name_town': 'Crespina Lorenzana', 'distance': 6651.705880196427}, {'edifc_uso': '0201', 'edifc_ty': '01', 'edifc_sot': '01', 'classid': 'RT0201020000079851', 'edifc_nome': 'MUNICIPIO DI CASCIANA TERME LARI', 'edifc_stat': '03', 'edifc_at': -9999.0, 'scril': '10k', 'meta_ist': '02', 'edifc_mon': '02', 'shape_Length': 71.4164695400369, 'shape_Area': 238.7290583304404, 'index_town': 6019, 'id': 6020, 'osm_id': '42490', 'osm_type': 'relation', 'osm_url': 'https://www.openstreetmap.org/relation/42490', 'name': 'Casciana Terme Lari', 'id_hall': 5879, 'osm_id_hall': '712404725', 'osm_type_hall': 'way', 'osm_url_hall': 'https://www.openstreetmap.org/way/712404725', 'name_hall': None, 'id_town': 6020, 'osm_id_town': '42490', 'osm_type_town': 'relation', 'osm_url_town': 'https://www.openstreetmap.org/relation/42490', 'name_town': 'Casciana Terme Lari', 'distance': 6851.794945263404}, {'edifc_uso': '0201', 'edifc_ty': '01', 'edifc_sot': '01', 'classid': 'RT0201020000088558', 'edifc_nome': 'MUNICIPIO DI ABETONE CUTIGLIANO', 'edifc_stat': '03', 'edifc_at': -9999.0, 'scril': '10k', 'meta_ist': '02', 'edifc_mon': '02', 'shape_Length': 128.76095254375988, 'shape_Area': 625.8798392281848, 'index_town': 6187, 'id': 6188, 'osm_id': '42848', 'osm_type': 'relation', 'osm_url': 'https://www.openstreetmap.org/relation/42848', 'name': 'Abetone Cutigliano', 'id_hall': 6016, 'osm_id_hall': '142715976', 'osm_type_hall': 'way', 'osm_url_hall': 'https://www.openstreetmap.org/way/142715976', 'name_hall': 'Abetone', 'id_town': 6188, 'osm_id_town': '42848', 'osm_type_town': 'relation', 'osm_url_town': 'https://www.openstreetmap.org/relation/42848', 'name_town': 'Abetone Cutigliano', 'distance': 12144.312207901707}, {'edifc_uso': '0201', 'edifc_ty': '01', 'edifc_sot': '01', 'classid': '9e036e1d-036c-4198-b93e-ff9ecf0b05f8', 'edifc_nome': 'Municipio di Monteciccardo', 'edifc_stat': '03', 'edifc_at': -29999.0, 'scril': '10k', 'meta_ist': '04', 'edifc_mon': '02', 'shape_Length': 46.66133051026014, 'shape_Area': 131.9397689999149, 'index_town': 6489, 'id': 6490, 'osm_id': '42672', 'osm_type': 'relation', 'osm_url': 'https://www.openstreetmap.org/relation/42672', 'name': 'Pesaro', 'id_hall': 2131, 'osm_id_hall': '5665557322', 'osm_type_hall': 'node', 'osm_url_hall': 'https://www.openstreetmap.org/node/5665557322', 'name_hall': 'Municipio di Pesaro', 'id_town': 6490, 'osm_id_town': '42672', 'osm_type_town': 'relation', 'osm_url_town': 'https://www.openstreetmap.org/relation/42672', 'name_town': 'Pesaro', 'distance': 18231.214197784855}, {'edifc_uso': '0201', 'edifc_ty': '01', 'edifc_sot': '01', 'classid': 'f970a576-23b9-4f2b-a529-5af69c7c95b4', 'edifc_nome': 'Municipio di Terre Roveresche', 'edifc_stat': '03', 'edifc_at': -29999.0, 'scril': '10k', 'meta_ist': '07', 'edifc_mon': '02', 'shape_Length': 65.4285529687661, 'shape_Area': 256.1828274110433, 'index_town': 6495, 'id': 6496, 'osm_id': '42575', 'osm_type': 'relation', 'osm_url': 'https://www.openstreetmap.org/relation/42575', 'name': 'Terre Roveresche', 'id_hall': 2118, 'osm_id_hall': '4001205941', 'osm_type_hall': 'node', 'osm_url_hall': 'https://www.openstreetmap.org/node/4001205941', 'name_hall': 'Municipio di Piagge', 'id_town': 6496, 'osm_id_town': '42575', 'osm_type_town': 'relation', 'osm_url_town': 'https://www.openstreetmap.org/relation/42575', 'name_town': 'Terre Roveresche', 'distance': 7776.617542485197}, {'edifc_uso': '0201', 'edifc_ty': '01', 'edifc_sot': '01', 'classid': 'f970a576-23b9-4f2b-a529-5af69c7c95b4', 'edifc_nome': 'Municipio di Terre Roveresche', 'edifc_stat': '03', 'edifc_at': -29999.0, 'scril': '10k', 'meta_ist': '07', 'edifc_mon': '02', 'shape_Length': 65.4285529687661, 'shape_Area': 256.1828274110433, 'index_town': 6495, 'id': 6496, 'osm_id': '42575', 'osm_type': 'relation', 'osm_url': 'https://www.openstreetmap.org/relation/42575', 'name': 'Terre Roveresche', 'id_hall': 2119, 'osm_id_hall': '4013505331', 'osm_type_hall': 'node', 'osm_url_hall': 'https://www.openstreetmap.org/node/4013505331', 'name_hall': 'Municipio di San Giorgio di Pesaro', 'id_town': 6496, 'osm_id_town': '42575', 'osm_type_town': 'relation', 'osm_url_town': 'https://www.openstreetmap.org/relation/42575', 'name_town': 'Terre Roveresche', 'distance': 5090.358252097032}, {'edifc_uso': '0201', 'edifc_ty': '01', 'edifc_sot': '01', 'classid': '55df3044-87d9-41e0-a63f-4a5393ef0cda', 'edifc_nome': 'COMUNE DI PALIZZI', 'edifc_stat': '03', 'edifc_at': -9999.0, 'scril': '5000', 'meta_ist': '04', 'edifc_mon': '02', 'shape_Length': 56.580372044597794, 'shape_Area': 147.29286888085977, 'index_town': 1328, 'id': 1329, 'osm_id': '39423', 'osm_type': 'relation', 'osm_url': 'https://www.openstreetmap.org/relation/39423', 'name': 'Palizzi', 'id_hall': 3398, 'osm_id_hall': '1066436571', 'osm_type_hall': 'way', 'osm_url_hall': 'https://www.openstreetmap.org/way/1066436571', 'name_hall': None, 'id_town': 1329, 'osm_id_town': '39423', 'osm_type_town': 'relation', 'osm_url_town': 'https://www.openstreetmap.org/relation/39423', 'name_town': 'Palizzi', 'distance': 6735.270475204972}, {'edifc_uso': '0201', 'edifc_ty': '01', 'edifc_sot': '01', 'classid': '65e8ae85-ebfe-4495-8081-c028b0ed9d62', 'edifc_nome': 'COMUNE DI FERRUZZANO', 'edifc_stat': '03', 'edifc_at': -9999.0, 'scril': '5000', 'meta_ist': '04', 'edifc_mon': '02', 'shape_Length': 71.01559404479887, 'shape_Area': 260.42096193890205, 'index_town': 1332, 'id': 1333, 'osm_id': '39487', 'osm_type': 'relation', 'osm_url': 'https://www.openstreetmap.org/relation/39487', 'name': 'Ferruzzano', 'id_hall': 3402, 'osm_id_hall': '1054261999', 'osm_type_hall': 'way', 'osm_url_hall': 'https://www.openstreetmap.org/way/1054261999', 'name_hall': None, 'id_town': 1333, 'osm_id_town': '39487', 'osm_type_town': 'relation', 'osm_url_town': 'https://www.openstreetmap.org/relation/39487', 'name_town': 'Ferruzzano', 'distance': 5801.193181314942}, {'edifc_uso': '0201', 'edifc_ty': '01', 'edifc_sot': '01', 'classid': '1e2423c4-372c-4824-a30c-072ba0019bb0', 'edifc_nome': 'COMUNE DI REGGIO CALABRIA', 'edifc_stat': '03', 'edifc_at': -9999.0, 'scril': '5000', 'meta_ist': '04', 'edifc_mon': '02', 'shape_Length': 344.64705342739927, 'shape_Area': 1908.5833080383682, 'index_town': 1249, 'id': 1250, 'osm_id': '39503', 'osm_type': 'relation', 'osm_url': 'https://www.openstreetmap.org/relation/39503', 'name': 'Reggio di Calabria', 'id_hall': 7056, 'osm_id_hall': '2594639', 'osm_type_hall': 'relation', 'osm_url_hall': 'https://www.openstreetmap.org/relation/2594639', 'name_hall': None, 'id_town': 1250, 'osm_id_town': '39503', 'osm_type_town': 'relation', 'osm_url_town': 'https://www.openstreetmap.org/relation/39503', 'name_town': 'Reggio di Calabria', 'distance': 11922.945577317534}, {'edifc_uso': '0201', 'edifc_ty': '01', 'edifc_sot': '01', 'classid': '1200c851-eeb1-4dc1-970b-a5a82ce07a44', 'edifc_nome': 'MUNICIPIO DI ROMA', 'edifc_stat': '03', 'edifc_at': -9999.0, 'scril': '5k', 'meta_ist': '04', 'edifc_mon': '02', 'shape_Length': 345.3647636797639, 'shape_Area': 2841.609939188057, 'index_town': 560, 'id': 561, 'osm_id': '41485', 'osm_type': 'relation', 'osm_url': 'https://www.openstreetmap.org/relation/41485', 'name': 'Roma', 'id_hall': 101, 'osm_id_hall': '259607231', 'osm_type_hall': 'node', 'osm_url_hall': 'https://www.openstreetmap.org/node/259607231', 'name_hall': '2° Municipio', 'id_town': 561, 'osm_id_town': '41485', 'osm_type_town': 'relation', 'osm_url_town': 'https://www.openstreetmap.org/relation/41485', 'name_town': 'Roma', 'distance': 6728.715758141061}, {'edifc_uso': '0201', 'edifc_ty': '01', 'edifc_sot': '01', 'classid': '1200c851-eeb1-4dc1-970b-a5a82ce07a44', 'edifc_nome': 'MUNICIPIO DI ROMA', 'edifc_stat': '03', 'edifc_at': -9999.0, 'scril': '5k', 'meta_ist': '04', 'edifc_mon': '02', 'shape_Length': 345.3647636797639, 'shape_Area': 2841.609939188057, 'index_town': 560, 'id': 561, 'osm_id': '41485', 'osm_type': 'relation', 'osm_url': 'https://www.openstreetmap.org/relation/41485', 'name': 'Roma', 'id_hall': 102, 'osm_id_hall': '4207410759', 'osm_type_hall': 'node', 'osm_url_hall': 'https://www.openstreetmap.org/node/4207410759', 'name_hall': None, 'id_town': 561, 'osm_id_town': '41485', 'osm_type_town': 'relation', 'osm_url_town': 'https://www.openstreetmap.org/relation/41485', 'name_town': 'Roma', 'distance': 10842.108320185042}, {'edifc_uso': '0201', 'edifc_ty': '01', 'edifc_sot': '01', 'classid': '1200c851-eeb1-4dc1-970b-a5a82ce07a44', 'edifc_nome': 'MUNICIPIO DI ROMA', 'edifc_stat': '03', 'edifc_at': -9999.0, 'scril': '5k', 'meta_ist': '04', 'edifc_mon': '02', 'shape_Length': 345.3647636797639, 'shape_Area': 2841.609939188057, 'index_town': 560, 'id': 561, 'osm_id': '41485', 'osm_type': 'relation', 'osm_url': 'https://www.openstreetmap.org/relation/41485', 'name': 'Roma', 'id_hall': 103, 'osm_id_hall': '2074461396', 'osm_type_hall': 'node', 'osm_url_hall': 'https://www.openstreetmap.org/node/2074461396', 'name_hall': 'LabPuzzle!', 'id_town': 561, 'osm_id_town': '41485', 'osm_type_town': 'relation', 'osm_url_town': 'https://www.openstreetmap.org/relation/41485', 'name_town': 'Roma', 'distance': 9694.114724250649}, {'edifc_uso': '0201', 'edifc_ty': '01', 'edifc_sot': '01', 'classid': '1200c851-eeb1-4dc1-970b-a5a82ce07a44', 'edifc_nome': 'MUNICIPIO DI ROMA', 'edifc_stat': '03', 'edifc_at': -9999.0, 'scril': '5k', 'meta_ist': '04', 'edifc_mon': '02', 'shape_Length': 345.3647636797639, 'shape_Area': 2841.609939188057, 'index_town': 560, 'id': 561, 'osm_id': '41485', 'osm_type': 'relation', 'osm_url': 'https://www.openstreetmap.org/relation/41485', 'name': 'Roma', 'id_hall': 104, 'osm_id_hall': '574960636', 'osm_type_hall': 'node', 'osm_url_hall': 'https://www.openstreetmap.org/node/574960636', 'name_hall': 'Municipio IV', 'id_town': 561, 'osm_id_town': '41485', 'osm_type_town': 'relation', 'osm_url_town': 'https://www.openstreetmap.org/relation/41485', 'name_town': 'Roma', 'distance': 9781.893897318194}, {'edifc_uso': '0201', 'edifc_ty': '01', 'edifc_sot': '01', 'classid': '2a2f39d9-d80d-4c7b-809b-03d76b918bf3', 'edifc_nome': 'MUNICIPIO DI CAPACCIO', 'edifc_stat': '03', 'edifc_at': -9999.0, 'scril': '5000', 'meta_ist': '04', 'edifc_mon': '02', 'shape_Length': 120.62707592859313, 'shape_Area': 653.625, 'index_town': 1762, 'id': 1763, 'osm_id': '40478', 'osm_type': 'relation', 'osm_url': 'https://www.openstreetmap.org/relation/40478', 'name': 'Capaccio Paestum', 'id_hall': 3675, 'osm_id_hall': '236634157', 'osm_type_hall': 'way', 'osm_url_hall': 'https://www.openstreetmap.org/way/236634157', 'name_hall': 'Municipio Capaccio - Sede distaccata', 'id_town': 1763, 'osm_id_town': '40478', 'osm_type_town': 'relation', 'osm_url_town': 'https://www.openstreetmap.org/relation/40478', 'name_town': 'Capaccio Paestum', 'distance': 9602.967276505778}, {'edifc_uso': '0201', 'edifc_ty': '01', 'edifc_sot': '01', 'classid': 'RT0201020001440112', 'edifc_nome': 'MUNICIPIO DI MONTALCINO', 'edifc_stat': '03', 'edifc_at': -9999.0, 'scril': '10k', 'meta_ist': '02', 'edifc_mon': '02', 'shape_Length': 138.14355814153848, 'shape_Area': 506.2485914970676, 'index_town': 533, 'id': 534, 'osm_id': '42262', 'osm_type': 'relation', 'osm_url': 'https://www.openstreetmap.org/relation/42262', 'name': 'Montalcino', 'id_hall': 95, 'osm_id_hall': '4167637381', 'osm_type_hall': 'node', 'osm_url_hall': 'https://www.openstreetmap.org/node/4167637381', 'name_hall': None, 'id_town': 534, 'osm_id_town': '42262', 'osm_type_town': 'relation', 'osm_url_town': 'https://www.openstreetmap.org/relation/42262', 'name_town': 'Montalcino', 'distance': 17848.068603288342}, {'edifc_uso': '0201', 'edifc_ty': '01', 'edifc_sot': '01', 'classid': '60806A4C-E85D-4EFC-AA06-99CB44B0F45F', 'edifc_nome': 'Uff.Anagrafe Del Fertilia', 'edifc_stat': '03', 'edifc_at': -9999.0, 'scril': '10k', 'meta_ist': '04', 'edifc_mon': '02', 'shape_Length': 154.52337981083133, 'shape_Area': 663.0415723080498, 'index_town': 255, 'id': 256, 'osm_id': '40581', 'osm_type': 'relation', 'osm_url': 'https://www.openstreetmap.org/relation/40581', 'name': "Alghero - L'Alguer", 'id_hall': 65, 'osm_id_hall': '4004385018', 'osm_type_hall': 'node', 'osm_url_hall': 'https://www.openstreetmap.org/node/4004385018', 'name_hall': 'Palazzo Civico', 'id_town': 256, 'osm_id_town': '40581', 'osm_type_town': 'relation', 'osm_url_town': 'https://www.openstreetmap.org/relation/40581', 'name_town': "Alghero - L'Alguer", 'distance': 5842.7542295963885}, {'edifc_uso': '0201', 'edifc_ty': '01', 'edifc_sot': '01', 'classid': '60806A4C-E85D-4EFC-AA06-99CB44B0F45F', 'edifc_nome': 'Uff.Anagrafe Del Fertilia', 'edifc_stat': '03', 'edifc_at': -9999.0, 'scril': '10k', 'meta_ist': '04', 'edifc_mon': '02', 'shape_Length': 154.52337981083133, 'shape_Area': 663.0415723080498, 'index_town': 255, 'id': 256, 'osm_id': '40581', 'osm_type': 'relation', 'osm_url': 'https://www.openstreetmap.org/relation/40581', 'name': "Alghero - L'Alguer", 'id_hall': 2875, 'osm_id_hall': '279264384', 'osm_type_hall': 'way', 'osm_url_hall': 'https://www.openstreetmap.org/way/279264384', 'name_hall': 'Comune di Alghero', 'id_town': 256, 'osm_id_town': '40581', 'osm_type_town': 'relation', 'osm_url_town': 'https://www.openstreetmap.org/relation/40581', 'name_town': "Alghero - L'Alguer", 'distance': 8186.110450784441}, {'edifc_uso': '0201', 'edifc_ty': '01', 'edifc_sot': '01', 'classid': 'e66f5332-6ffe-4bfb-9547-e787ca32362e', 'edifc_nome': 'Municipio del Comune di Taranto', 'edifc_stat': '03', 'edifc_at': -9999.0, 'scril': '5000', 'meta_ist': '04', 'edifc_mon': '02', 'shape_Length': 177.2023020280719, 'shape_Area': 1100.0508214834701, 'index_town': 3038, 'id': 3039, 'osm_id': '40452', 'osm_type': 'relation', 'osm_url': 'https://www.openstreetmap.org/relation/40452', 'name': 'Taranto', 'id_hall': 807, 'osm_id_hall': '2090708345', 'osm_type_hall': 'node', 'osm_url_hall': 'https://www.openstreetmap.org/node/2090708345', 'name_hall': 'Municipio', 'id_town': 3039, 'osm_id_town': '40452', 'osm_type_town': 'relation', 'osm_url_town': 'https://www.openstreetmap.org/relation/40452', 'name_town': 'Taranto', 'distance': 10698.176428686338}, {'edifc_uso': '0201', 'edifc_ty': '01', 'edifc_sot': '01', 'classid': '68d82f6b-b0e5-44d2-84fc-d669c6fc66f1', 'edifc_nome': 'MUNICIPIO DI  ATRI, PALAZZO DUCALE', 'edifc_stat': '91', 'edifc_at': -9999.0, 'scril': '5000', 'meta_ist': '04', 'edifc_mon': '02', 'shape_Length': 256.2418128496991, 'shape_Area': 1526.3808685471536, 'index_town': 2932, 'id': 2933, 'osm_id': '42075', 'osm_type': 'relation', 'osm_url': 'https://www.openstreetmap.org/relation/42075', 'name': 'Atri', 'id_hall': 769, 'osm_id_hall': '2335530685', 'osm_type_hall': 'node', 'osm_url_hall': 'https://www.openstreetmap.org/node/2335530685', 'name_hall': None, 'id_town': 2933, 'osm_id_town': '42075', 'osm_type_town': 'relation', 'osm_url_town': 'https://www.openstreetmap.org/relation/42075', 'name_town': 'Atri', 'distance': 7375.594881488029}] to MultiPolygon for full functionality.
https://tools.ietf.org/html/rfc7946#page-9
  warnings.warn(
Out[ ]:
Make this Notebook Trusted to load map: File -> Trust Notebook
In [ ]:
dbsn_conflict_gdf.drop(["geometry_x", "geometry_y"], axis=1).to_file(dbsn_conflict_file_path, driver="GeoJSON")

Getting missing town halls from Public Data¶

In [ ]:
dbsn_missing_df = dbsn_gdf.sjoin(
    without_townhall_gdf,
    how="inner",
    predicate="within"
)
dbsn_missing_df.count()
Out[ ]:
edifc_uso       849
edifc_ty        849
edifc_sot       849
classid         844
edifc_nome      849
edifc_stat      849
edifc_at        832
scril           832
meta_ist        848
edifc_mon       849
shape_Length    849
shape_Area      849
geometry        849
index_right     849
id              849
osm_id          849
osm_type        849
osm_url         849
name            849
dtype: int64
In [ ]:
dbsn_missing_df.head()
Out[ ]:
edifc_uso edifc_ty edifc_sot classid edifc_nome edifc_stat edifc_at scril meta_ist edifc_mon shape_Length shape_Area geometry index_right id osm_id osm_type osm_url name
51 0201 01 01 ccebcf60-070d-4e16-a5b5-ddaae2aebab3 Municipio di Castelbellino 03 -29999.0 10k 04 02 112.731642 498.948045 MULTIPOLYGON Z (((13.14609 43.48797 0.00000, 1... 6471 6472 42476 relation https://www.openstreetmap.org/relation/42476 Castelbellino
52 0201 01 01 c33b9af6-8977-4c18-b181-6da6f1d4ad4c Municipio di San Paolo di Jesi 03 -29999.0 10k 04 02 133.693143 783.324298 MULTIPOLYGON Z (((13.17384 43.45493 0.00000, 1... 6458 6459 42462 relation https://www.openstreetmap.org/relation/42462 San Paolo di Jesi
61 0201 01 01 E0577A0C-BD70-473B-B93E-2CD1EC108339 Municipio di Cupramontana 03 -9999.0 10k 05 02 110.947122 502.926217 MULTIPOLYGON Z (((13.11578 43.44564 0.00000, 1... 6448 6449 42451 relation https://www.openstreetmap.org/relation/42451 Cupramontana
64 0201 01 01 4bd670b4-e7de-4c0d-8412-e504b335a90b Municipio di Poggio San Marcello 03 -29999.0 10k 04 02 61.302157 230.025172 MULTIPOLYGON Z (((13.07699 43.51150 0.00000, 1... 6468 6469 49127 relation https://www.openstreetmap.org/relation/49127 Poggio San Marcello
78 0201 01 01 b065057b-7b88-4dd0-afd0-82bfddbc2314 Municipio di Belvedere Ostrense 03 -29999.0 10k 04 02 80.870315 321.332155 MULTIPOLYGON Z (((13.16665 43.58040 0.00000, 1... 6462 6463 42496 relation https://www.openstreetmap.org/relation/42496 Belvedere Ostrense
In [ ]:
dbsn_missing_df.to_file(dbsn_missing_file_path, driver="GeoJSON")
In [ ]:
#%pip install folium matplotlib mapclassify
dbsn_missing_df.explore()
Out[ ]:
Make this Notebook Trusted to load map: File -> Trust Notebook